<%--
  Created by IntelliJ IDEA.
  Date: 2022/5/13
  Time: 0:18
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    String basePath = request.getScheme() + "://" +
            request.getServerName() + ":" + request.getServerPort() +
            request.getContextPath() + "/";
%>
<%@page isELIgnored="false" %>
<html>
<head>
    <title>宠物诊所系统</title>
    <base href="<%=basePath%>">
    <link rel="shortcut icon" href="${pageContext.request.contextPath}/favicon.ico" type="image/x-icon"/>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/layui.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/bootstrap.min.css">
    <script src="${pageContext.request.contextPath}/static/js/jquery.min.js"></script>
    <script src="${pageContext.request.contextPath}/static/js/layui.js"></script>
    <script src="${pageContext.request.contextPath}/static/js/bootstrap.min.js"></script>
</head>
<body>
<div class="layui-layout layui-layout-admin">
    <div class="layui-header">
        <div class="layui-logo layui-hide-xs layui-bg-black" onclick="toIndex()">宠物诊所系统</div>
        <ul class="layui-nav text-center">
            <li id="hitokoto" class="layui-nav-item " onclick="getHitokoto()"></li>
        </ul>
        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item layui-hide layui-show-md-inline-block">
            <li class="layui-nav-item">
                <a href="javascript:void(0)">
                    管理员
                </a>
                <dl class="layui-nav-child">
                    <dd><a href="${pageContext.request.contextPath}/logout" id="logout">退出登录</a></dd>
                </dl>
            </li>
            </li>
        </ul>
    </div>
    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <ul class="layui-nav" lay-filter="">
                <li class="layui-nav-item">
                    <a href="javascript:void(0)" id="getVet" onclick="getVet()">
                        兽医名单
                    </a>
                </li>

                <li class="layui-nav-item">
                    <a href="javascript:void(0)" id="getPets" onclick="getPets()">
                        诊所宠物
                    </a>
                </li>

                </li>

                <li class="layui-nav-item">
                    <a href="javascript:void(0)" id="addCustomer" onclick="addOwner()">
                        客户登记
                    </a>
                </li>

                <li class="layui-nav-item">
                    <a href="javascript:void(0)" id="getRecord" onclick="getVisit()">
                        近期诊断记录
                    </a>
                </li>
            </ul>

        </div>
    </div>
    <div class="layui-body">

        <iframe frameborder="0" height="100%" width="100%" id="ifr">
        </iframe>
    </div>

    <script>
        window.onload = function () {
            $("#ifr").attr("src", "${pageContext.request.contextPath}/jsp/IndexInfo.jsp")
            getHitokoto();
        }
        function toIndex(){
            $("#ifr").attr("src", "${pageContext.request.contextPath}/jsp/IndexInfo.jsp")
        }
        function getVet() {
            $("#ifr").attr("src", "${pageContext.request.contextPath}/jsp/getVet.jsp")
        }

        function getPets() {
            $("#ifr").attr("src", "${pageContext.request.contextPath}/jsp/getPets.jsp")
        }

        function addOwner() {
            $("#ifr").attr("src", "${pageContext.request.contextPath}/jsp/addOwner.jsp")
        }
        function getVisit() {
            $("#ifr").attr("src", "${pageContext.request.contextPath}/jsp/getVisits.jsp")
        }

        function getHitokoto() {
            $.ajax({
                url: "https://v1.hitokoto.cn/?c=d",
                type: "get",
                success:function(data){
                    $("#hitokoto").html(data.hitokoto)
                }
            })
        }

    </script>

</div>
</body>

</html>
